﻿using monitoring_system.Share;
using Prism.Commands;
using Prism.Regions;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace monitoring_system.ViewModels
{
    public class MainViewModel
    {
        public IRegionManager RegionManager {get; }
        public ICommand LogoutCommand {get; }
        public ICommand LoadedCommand {get; }
        public MainViewModel(IRegionManager regionManager)
        {
            RegionManager=regionManager;
            LogoutCommand = ReactiveCommand.Create(OnLogoutCommand);
            LoadedCommand = new DelegateCommand(OnLoadedCommand);
        }

        private void OnLoadedCommand()
        {
            RegionManager.RequestNavigate(RegionNames.ContainerRegion, ViewNames.IndexView);
        }

        private void OnLogoutCommand()
        {
            RegionManager.RequestNavigate(RegionNames.MainRegion,ViewNames.LoginView);
        }
    }
}
